Unify colour handling in selects and buttons - #140
Open
biast12 wants to merge 1 commit into
Open
Conversation
Adds shared colour utilities (`lib/colour.ts`) and centralized Discord button style constants (`constants/buttonStyles.ts`), then refactors components/pages to use them. This removes duplicated hex conversion logic, normalizes colour input formats, and applies consistent color swatches in Select/MultiSelect/role-related UIs (including proper fallback for Discord role color `0`). It also reuses shared gallery type badge/options metadata to eliminate duplicated type option definitions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Button Colour picker on the panel create/edit pages listed Blue / Grey / Green / Red as plain text — you had to already know Discord's palette to pick correctly. Each option now shows its actual colour, plus the same treatment everywhere else it fits.
Selectalready supported a per-optioncolor; the options simply never passed one, so no new component was needed.Changes
Button Colour — options carry their colour, shared from a new
constants/buttonStyles.tsso the picker and the livePanelPreviewread from one table.#4752c4/#4f545c/#2d7d46/#a12d2f) to its current button colours (#5865F2/#4E5058/#248046/#DA373C), so preview buttons now match what Discord actually renders.discord/container/Button.tsxpaints the background inline rather than via a Tailwind class — a class name built from a map is never generated at build time.Dots that never worked —
MultiSelectexpectedabc123for its dot but#abc123for its chip tint, so one was always invalid CSS. Both selects now normalise the value:0x00b0f4produced#b0f4(invalid, no dot) → now#00b0f4#0→ now Discord's default grey#99AAB5instead of blackcolor-mix(… 20%)matchingLabelBadgeNew swatches — the access-control "Add Role" picker (dropdown and the added-role list), the setup wizard's Teams step (colour was being stripped in
Setup.tsx), and the Guild Settings / Tickets / Transcripts panel pickers.Status dots on the four filters whose values already have a badge colour: affiliate status, gallery type (×2), bot-staff tier.
GALLERY_TYPE_BADGESis now the single source — the duplicate map inGalleryCard.tsxand both localTYPE_OPTIONScopies are gone.intToColour/colourToIntwere defined three times; both now live inlib/colour.ts.Type of Change
Checklist